home *** CD-ROM | disk | FTP | other *** search
- rem **************************************************************************
- rem * *
- rem * This is the actual script used to install PowerInstall. *
- rem * *
- rem * If you're running the PowerInstall install program, then you're *
- rem * viewing this file via a one line script command called 'VIEW_FILE'. *
- rem * You can find it a couple pages down where the main menu is read via *
- rem * 'READ_MENU'. *
- rem * *
- rem **************************************************************************
-
- rem **************************************************************************
- rem * *
- rem * Declare variables *
- rem * *
- rem **************************************************************************
-
- intvar titlewin Title window handle
- intvar mainmenu Main menu window handle
- intvar destwin Install path window
- intvar errwin Error window handle
- intvar msgwin General messages
-
- intvar key Hold key from read_menu
- intvar tmp Temp for return codes
- intvar menusel Menu sel from read_menu
-
- strvar destdir Dir to install to
- strvar errstr String for error window
- strvar copydest Build file copy paths
- strvar srcfile Source file for copy
-
- rem **************************************************************************
- rem * *
- rem * Define windows *
- rem * *
- rem **************************************************************************
-
- mainmenu = define_win 24 9 28 8 1 yes ' ' black white black white
-
- titlewin = define_win 32 3 24 2 1 yes ' ' black white blue white
- win_puts titlewin 1 1 " Welcome to PowerInstall v1.0 "
-
- msgwin = define_win 62 5 9 10 2 yes ' ' white blue ltwhite black
-
- errwin = define_win 62 5 9 17 2 yes ' ' white red ltwhite black
- win_puts errwin 1 4 "[ Hit <enter> or click left ]"
-
- destwin = define_win 54 5 13 7 1 yes ' ' white blue ltbrown blue
- win_puts destwin 2 2 "Directory: "
- win_puts destwin 0 13 " Where to put PowerInstall ? "
-
- rem **************************************************************************
- rem * *
- rem * Define menu options *
- rem * *
- rem * Window handle. Window column & row. Hotkey (0 if none). *
- rem * *
- rem * *
- rem **************************************************************************
-
- define_menusel mainmenu 1 1 0 ltwhite black blue white " Read THIS Script "
- define_menusel mainmenu 1 2 0 ltwhite black blue white " Read READ.ME "
- define_menusel mainmenu 1 3 0 ltwhite black blue white " Read VENDOR.DOC "
- define_menusel mainmenu 1 4 0 ltwhite black blue white " Read WHATSNEW "
- define_menusel mainmenu 1 5 0 ltwhite black blue white " Read ORDER.DOC "
- define_menusel mainmenu 1 6 0 ltwhite black blue white " Install PowerInstall "
- define_menusel mainmenu 1 7 0 ltwhite black blue white " Exit "
-
- rem **************************************************************************
- rem * *
- rem * Begin script *
- rem * *
- rem **************************************************************************
-
- destdir = "C:\PINST" Initial directory
-
- curtain
- show_win titlewin Show title window
- pause
- pause
-
- win_puts msgwin 14 2 "How'd you like that installation ?"
- show_win msgwin
- read_key
- hide_win msgwin
- win_puts msgwin 14 2 " "
-
- win_puts msgwin 2 2 "You just witnessed an ordinary self-extracting archive..."
- show_win msgwin
- read_key
- hide_win msgwin
- win_puts msgwin 2 2 " "
-
- win_puts msgwin 5 2 "...converted by PowerInstall to be self-installing !"
- show_win msgwin
- read_key
- hide_win msgwin
- win_puts msgwin 5 2 " "
-
- win_puts msgwin 4 2 "Also, THIS program is a PowerInstall compiled script."
- show_win msgwin
- read_key
- hide_win msgwin
- win_puts msgwin 4 2 " "
-
- win_puts msgwin 12 2 "And now, lets install PowerInstall..."
- show_win msgwin
- read_key
- hide_win msgwin
- win_puts msgwin 12 2 " "
-
- rem **************************************************************************
- rem * *
- rem * Read main menu *
- rem * *
- rem **************************************************************************
-
- label menuloop Used for GOTO,GOSUB
-
- key = read_menu mainmenu menusel This performs the whole menu
-
- if key == ESC goto done_install Exit installation
- if key <> 13 goto menuloop Wait for enter key
-
- if menusel == 0 view_file "install.pow" View this script
- if menusel == 1 view_file "read.me" View read.me
- if menusel == 2 view_file "vendor.doc" View vendor.doc
- if menusel == 3 view_file "whatsnew" View whatsnew
- if menusel == 4 view_file "order.doc" View order.doc
- if menusel == 5 gosub do_install Perform installation
- if menusel == 6 goto done_install Exit installation
-
- goto menuloop Back to menu
-
- rem **************************************************************************
- rem * *
- rem * Do install *
- rem * *
- rem **************************************************************************
-
- label do_install
-
- show_win destwin Show window
-
- tmp = read_string destwin 13 2 38 ltwhite black yes destdir Read path
- if tmp <> 0 goto verify_it Aborted ?
-
- hide_win destwin Hide window
- return Back to menu
-
- label verify_it
-
- tmp = verify_path destdir Verify path
-
- rem ********************** Critical error *********************************
-
- if tmp <> 4 goto not_crit Critical ?
- errstr = " Drive not ready"
- gosub show_error Show error
- goto do_install Get path again
-
- rem ********************** Is path a file ? *******************************
-
- label not_crit
- if tmp <> 3 goto notfile Is a file ?
- errstr = " That is a file"
- gosub show_error Show error
- goto do_install Get path again
-
- rem *************************** Bad dir ***********************************
-
- label notfile
- if tmp <> 2 goto not_disk Bad dir ?
-
- win_puts msgwin 13 2 "Directory not found. Create (y/N) ?"
- show_win msgwin Prompt to create
- tmp = read_key Get answer
- hide_win msgwin
- win_puts msgwin 13 2 " "
- if tmp <> 'Y' if tmp <> 'y' goto do_install 'Y' key pressed ?
-
- mkdir destdir Create directory
-
- goto good_dir Get path again
-
- rem *************************** Bad disk **********************************
-
- label not_disk
- if tmp <> 1 goto good_dir Bad disk ?
- errstr = " Bad disk"
- gosub show_error Show error
- goto do_install Get path again
-
-
- rem **************************************************************************
- rem * *
- rem * Good install directory. Copy files. *
- rem * *
- rem **************************************************************************
-
- label good_dir End of installation
-
- hide_win destwin Remove path window
-
- win_puts msgwin 16 2 "Copying PowerInstall files..." Write line
- show_win msgwin Show message
-
- srcfile = "install.pow" File to copy
- gosub copy_srcfile Do the copy
- if tmp == 1 goto donedoinstall Abort on error
- srcfile = "menu.pow" File to copy
- gosub copy_srcfile Do the copy
- if tmp == 1 goto donedoinstall Abort on error
- srcfile = "stack.pow" File to copy
- gosub copy_srcfile Do the copy
- if tmp == 1 goto donedoinstall Abort on error
- srcfile = "str_dir.pow" File to copy
- gosub copy_srcfile Do the copy
- if tmp == 1 goto donedoinstall Abort on error
- srcfile = "window.pow" File to copy
- gosub copy_srcfile Do the copy
- if tmp == 1 goto donedoinstall Abort on error
- srcfile = "pinst.exe" File to copy
- gosub copy_srcfile Do the copy
- if tmp == 1 goto donedoinstall Abort on error
- srcfile = "whatsnew" File to copy
- gosub copy_srcfile Do the copy
- if tmp == 1 goto donedoinstall Abort on error
- srcfile = "ascii.doc" File to copy
- gosub copy_srcfile Do the copy
- if tmp == 1 goto donedoinstall Abort on error
- srcfile = "pinst.doc" File to copy
- gosub copy_srcfile Do the copy
- if tmp == 1 goto donedoinstall Abort on error
- srcfile = "order.doc" File to copy
- gosub copy_srcfile Do the copy
- if tmp == 1 goto donedoinstall Abort on error
- srcfile = "quick.doc" File to copy
- gosub copy_srcfile Do the copy
- if tmp == 1 goto donedoinstall Abort on error
- srcfile = "vendor.doc" File to copy
- gosub copy_srcfile Do the copy
- if tmp == 1 goto donedoinstall Abort on error
- srcfile = "read.me" File to copy
- gosub copy_srcfile Do the copy
-
- label donedoinstall
-
- hide_win msgwin Remove message.
- win_puts msgwin 16 2 " " Clear line
- return
-
- rem **************************************************************************
- rem * *
- rem * Copy file routine. *
- rem * *
- rem * destdir = Destination path. *
- rem * srcfile = Source filename. *
- rem * *
- rem **************************************************************************
-
- label copy_srcfile
-
- copydest = addpathfile destdir srcfile Build dest path
- tmp = copy_file srcfile copydest Copy file
- if tmp == 0 return
-
- gosub bad_copy Copy error
- tmp = 1 Signal error
- return Back to installer
-
- rem **************************************************************************
- rem * *
- rem * File copy error. tmp = COPY_FILE error code. *
- rem * *
- rem **************************************************************************
-
- label bad_copy
-
- if tmp == 1 errstr = " Out of memory"
- if tmp == 2 errstr = " Can't open source file"
- if tmp == 3 errstr = " Can't open destination file"
- if tmp == 4 errstr = " Disk full"
-
- gosub show_error Show error message
- return Return to mani menu
-
- rem **************************************************************************
- rem * *
- rem * Show error window *
- rem * *
- rem **************************************************************************
-
- label show_error
-
- win_puts errwin 1 2 " "
- win_puts errwin 1 2 errstr Clear line and show string
-
- show_win errwin
- leftmouse Enter or left click
- hide_win errwin
-
- return
-
- rem **************************************************************************
- rem * *
- rem * Exit install *
- rem * *
- rem **************************************************************************
-
- label done_install
-
- hide_win mainmenu
- hide_win titlewin Remove windows
- clrscr
- cursorxy 0 0
- exit 0 Exit
-